import request from '@/utils/request'
const baseUrl = '/cz-rentbox/api/v1/releaseCallbacks' //回调箱服务--我的回调箱接口
// import {getAgentSelfTable } from '@/api/boxCallBack'

/* 
# 发布回调租箱:集装箱公司查询自己发布的分页列表
# POST {{baseUrl}}/releaseCallbacks/boxEastSelfPage
# 过滤条件：累计回调租量区间:beginTotalRentQty endTotalRentQty  创建时间时间区间:beginCreateDate endCreateDate
# 出发地城市Ids: List<Long> carryCityIds 到达地城市Ids: List<Long> returnCityIds
# 发布状态:status 5-出租中 10-仓库中 15-待发布
*/
export const getBoxEastSelfTable = (data: any) => {
  return request({
    url: baseUrl+'/boxEastSelfPage',
    method: 'post',
    data: data
    // data:{
    // "carryCityIds":[1,2,3],
    // "returnCityIds":[1,2,3],
    // "pageNum": 1,
    // "pageSize": 10
    // }
  })
}

/*
# 发布回调租箱:集装箱公司查询货代发布的分页列表(货代出租中)
# POST {{baseUrl}}/releaseCallbacks/boxEastAgentPage
# 过滤条件：累计回调租量区间:beginTotalRentQty endTotalRentQty 箱型:boxType 5 - 40HQ   10 - 40GP  15 - 20HQ   20 - 20GP 
# 箱况:boxCondition 5-全新   10-次新  15-适货 20-混提(次新或者适货)
# 出发地城市Ids: List<Long> carryCityIds 到达地城市Ids: List<Long> returnCityIds
*/
export const getBoxEastAgentTable = (data: any) => {
  return request({
    url: baseUrl+'/boxEastAgentPage',
    method: 'post',
    data: data
     // data:{
    // "carryCityIds":[1,2,3],
    // "returnCityIds":[1,2,3],
    // "pageNum": 1,
    // "pageSize": 10
    // }
  })
}

/*
# 发布回调租箱:代理查询自己发布的分页列表
# POST {{baseUrl}}/releaseCallbacks/agentSelfPage
# 过滤条件：累计回调租量区间:beginTotalRentQty endTotalRentQty  创建时间时间区间:beginCreateDate endCreateDate
# 出发地城市Ids: List<Long> carryCityIds 到达地城市Ids: List<Long> returnCityIds
# 发布状态:status 5-出租中 10-仓库中 15-待发布
*/
export const getAgentSelfTable = (data: any) => {
  return request({
    url: baseUrl+'/agentSelfPage',
    method: 'post',
    data: data
    // data:{
    // "carryCityIds":[1,2,3],
    // "returnCityIds":[1,2,3],
    // "pageNum": 1,
    // "pageSize": 10
    // }
  })
}

/*
# 发布回调租箱:货代查询集装箱公司发布的分页列表(集装箱公司出租中)
# POST {{baseUrl}}/releaseCallbacks/agentBoxEastPage
# 过滤条件：累计回调租量区间:beginTotalRentQty endTotalRentQty 箱型:boxType 5 - 40HQ   10 - 40GP  15 - 20HQ   20 - 20GP 
# 箱况:boxCondition 5-全新   10-次新  15-适货 20-混提(次新或者适货)
# 出发地城市Ids: List<Long> carryCityIds 到达地城市Ids: List<Long> returnCityIds
*/
export const getAgentBoxEastTable = (data: any) => {
  return request({
    url: baseUrl+'/agentBoxEastPage',
    method: 'post',
    data: data
    // data:{
    // "carryCityIds":[1,2,3],
    // "returnCityIds":[1,2,3],
    // "pageNum": 1,
    // "pageSize": 10
    // }
  })
}

/*
# 发布回调租箱:获取详情
# GET {{baseUrl}}/releaseCallbacks/{id}
*/
export const getBoxInfo = (id: any) => {
  return request({
    url: baseUrl+'/'+id,
    method: 'get'
  })
}

/* 
*发布回调租箱:根据城市Ids获取库存 
* # 输入model
    # [1,2,3]: 城市Id的数组
# 输出model:
    # 堆场城市Id:cityId
    # 集装箱箱型:boxType 5 - 40HQ   10 - 40GP  15 - 20HQ   20 - 20GP
    # 集装箱箱况:boxCondition 5-全新  10-次新  15-适货
    # 库存:inventory
*/
export const getCityInventory = (data: any) => {
  return request({
    url: baseUrl+'/cityInventoryCount',
    method: 'post',
    data: data
  })
}

/*发布回调租箱:集装箱公司保存待发布
# 输入参数:
    # carryCity:出发地城市JSON数组
    # returnCity:到达地城市JSON数组
    # repairFee:修箱费:-1=还箱时实报实销
    # repairFeeCurrency:修箱费币种:默认美元USD
    # boxUsagePeriod:箱使期
    # overdueFeeDay:超期一天的费用 /箱/天
    # overdueFeeCurrency:超期费币种 CNY:人民币 USD:美元 默认美元
    # lossDay:灭失天数
    # lossFee:灭失费
    # groundingMethod:上架方式 5-立即上架  10-放入仓库
    # mainFileList:主图
    # detailFileList:车主简介
    # 以上字段必填
    # cargoName:货品名称
    # remark:备注
# 输出model:
    # 1803633694563580226  主键Id
*/
export const boxEastTobeReleased = (data: any) => { //集装箱公司保存待发布
  return request({
    url: baseUrl+'/boxEastTobeReleased',
    method: 'post',
    data: data
   /* data:{
    "carryCity":"[{\"cityId\": 1,\"cityName\": \"郑州\",\"countryId\": 1,\"countryName\": \"中国\"},{\"cityId\": 2,\"cityName\": \"青岛\",\"countryId\": 1,\"countryName\": \"中国\"}]",
    "returnCity":"[{\"cityId\": 1,\"cityName\": \"郑州\",\"countryId\": 1,\"countryName\": \"中国\"},{\"cityId\": 2,\"cityName\": \"青岛\",\"countryId\": 1,\"countryName\": \"中国\"}]",
    "cargoName":"绿豆",
    "repairFee":5,
    "repairFeeCurrency":"USD",
    "boxUsagePeriod":60,
    "overdueFeeDay": 10,
    "overdueFeeCurrency":"USD",
    "lossDay":80,
    "lossFee":12000,
    "groundingMethod":5,
    "remark": "备注",
    "releaseCallbackPriceList":[{"boxType":5,"boxCondition":5,"totalWeight":32580,"inventory":25,"carryCityId":1,"carryCityName":"郑州","carryCountryId":1,"carryCountryName":"中国"}],
    "mainFileList": "[{\"name\":\"20240712/324ec5ab3da2443b934eb9bc596990d1.jpg\",\"originalFileName\":\"原图sync.jpg\",\"url\":\"http://47.122.3.254:9000/default/20240712/324ec5ab3da2443b934eb9bc596990d1.jpg\"}]",
    "detailFileList": "[{\"name\":\"20240712/324ec5ab3da2443b934eb9bc596990d1.jpg\",\"originalFileName\":\"原图sync.jpg\",\"url\":\"http://47.122.3.254:9000/default/20240712/324ec5ab3da2443b934eb9bc596990d1.jpg\"}]"
}*/
  })
}

/*发布回调租箱:货代保存待发布
# 输入参数:
    # carryCity:出发地城市JSON数组
    # returnCity:到达地城市JSON数组
    # repairFee:修箱费:-1=还箱时实报实销
    # repairFeeCurrency:修箱费币种:默认美元USD
    # boxUsagePeriod:箱使期
    # overdueFeeDay:超期一天的费用 /箱/天
    # overdueFeeCurrency:超期费币种 CNY:人民币 USD:美元 默认美元
    # lossDay:灭失天数
    # lossFee:灭失费
    # groundingMethod:上架方式 5-立即上架  10-放入仓库
    # mainFileList:主图
    # detailFileList:车主简介
    # 以上字段必填
    # cargoName:货品名称
    # remark:备注
# 输出model:
    # 1803633694563580226  主键Id
*/
export const agentTobeReleased = (data: any) => { //货代保存待发布
  return request({
    url: baseUrl+'/agentTobeReleased',
    method: 'post',
    data: data
   /**
{
    "carryCity":"[{\"cityId\": 1,\"cityName\": \"郑州\",\"countryId\": 1,\"countryName\": \"中国\"},{\"cityId\": 2,\"cityName\": \"青岛\",\"countryId\": 1,\"countryName\": \"中国\"}]",
    "returnCity":"[{\"cityId\": 1,\"cityName\": \"郑州\",\"countryId\": 1,\"countryName\": \"中国\"},{\"cityId\": 2,\"cityName\": \"青岛\",\"countryId\": 1,\"countryName\": \"中国\"}]",
    "cargoName":"绿豆",
    "repairFee":5,
    "repairFeeCurrency":"USD",
    "boxUsagePeriod":60,
    "overdueFeeDay": 10,
    "overdueFeeCurrency":"USD",
    "lossDay":80,
    "lossFee":12000,
    "groundingMethod":5,
    "remark": "备注",
    "releaseCallbackPriceList":[{"boxType":5,"boxCondition":5,"totalWeight":32580,"inventory":25,"carryCityId":1,"carryCityName":"郑州","carryCountryId":1,"carryCountryName":"中国"}],
    "mainFileList": "[{\"name\":\"20240712/324ec5ab3da2443b934eb9bc596990d1.jpg\",\"originalFileName\":\"原图sync.jpg\",\"url\":\"http://47.122.3.254:9000/default/20240712/324ec5ab3da2443b934eb9bc596990d1.jpg\"}]",
    "detailFileList": "[{\"name\":\"20240712/324ec5ab3da2443b934eb9bc596990d1.jpg\",\"originalFileName\":\"原图sync.jpg\",\"url\":\"http://47.122.3.254:9000/default/20240712/324ec5ab3da2443b934eb9bc596990d1.jpg\"}]"
}
    */
  })
}

/*发布回调租箱:集装箱公司提交发布
# 输入参数:
    # carryCity:出发地城市JSON数组
    # returnCity:到达地城市JSON数组
    # repairFee:修箱费:-1=还箱时实报实销
    # repairFeeCurrency:修箱费币种:默认美元USD
    # boxUsagePeriod:箱使期
    # overdueFeeDay:超期一天的费用 /箱/天
    # overdueFeeCurrency:超期费币种 CNY:人民币 USD:美元 默认美元
    # lossDay:灭失天数
    # lossFee:灭失费
    # groundingMethod:上架方式 5-立即上架  10-放入仓库
    # mainFileList:主图
    # detailFileList:车主简介
    # 以上字段必填
    # cargoName:货品名称
    # remark:备注
# 输出model:
    # 1803633694563580226  主键Id
*/
export const boxEastSubmit = (data: any) => {  //集装箱公司立即发布
  return request({
    url: baseUrl+'/boxEastSubmit',
    method: 'post',
    data: data
    /**
{
    "carryCity":"[{\"cityId\": 1,\"cityName\": \"郑州\",\"countryId\": 1,\"countryName\": \"中国\"},{\"cityId\": 2,\"cityName\": \"青岛\",\"countryId\": 1,\"countryName\": \"中国\"}]",
    "returnCity":"[{\"cityId\": 1,\"cityName\": \"郑州\",\"countryId\": 1,\"countryName\": \"中国\"},{\"cityId\": 2,\"cityName\": \"青岛\",\"countryId\": 1,\"countryName\": \"中国\"}]",
    "cargoName":"绿豆",
    "repairFee":5,
    "repairFeeCurrency":"USD",
    "boxUsagePeriod":60,
    "overdueFeeDay": 10,
    "overdueFeeCurrency":"USD",
    "lossDay":80,
    "lossFee":12000,
    "groundingMethod":5,
    "remark": "备注",
    "releaseCallbackPriceList":[{"boxType":5,"boxCondition":5,"totalWeight":32580,"inventory":2,"carryCityId":1,"carryCityName":"郑州","carryCountryId":1,"carryCountryName":"中国"}],
    "mainFileList": "[{\"name\":\"20240712/324ec5ab3da2443b934eb9bc596990d1.jpg\",\"originalFileName\":\"原图sync.jpg\",\"url\":\"http://47.122.3.254:9000/default/20240712/324ec5ab3da2443b934eb9bc596990d1.jpg\"}]",
    "detailFileList": "[{\"name\":\"20240712/324ec5ab3da2443b934eb9bc596990d1.jpg\",\"originalFileName\":\"原图sync.jpg\",\"url\":\"http://47.122.3.254:9000/default/20240712/324ec5ab3da2443b934eb9bc596990d1.jpg\"}]"
}
     */
  })
}

/*发布回调租箱:货代提交发布
# 输入参数:
    # carryCity:出发地城市JSON数组
    # returnCity:到达地城市JSON数组
    # repairFee:修箱费:-1=还箱时实报实销
    # repairFeeCurrency:修箱费币种:默认美元USD
    # boxUsagePeriod:箱使期
    # overdueFeeDay:超期一天的费用 /箱/天
    # overdueFeeCurrency:超期费币种 CNY:人民币 USD:美元 默认美元
    # lossDay:灭失天数
    # lossFee:灭失费
    # groundingMethod:上架方式 5-立即上架  10-放入仓库
    # mainFileList:主图
    # detailFileList:车主简介
    # 以上字段必填
    # cargoName:货品名称
    # remark:备注
# 输出model:
    # 1803633694563580226  主键Id
*/
export const agentSubmit = (data: any) => {  //货代立即发布
  return request({
    url: baseUrl+'/agentSubmit',
    method: 'post',
    data: data
   /**
{
    "carryCity":"[{\"cityId\": 1,\"cityName\": \"郑州\",\"countryId\": 1,\"countryName\": \"中国\"},{\"cityId\": 2,\"cityName\": \"青岛\",\"countryId\": 1,\"countryName\": \"中国\"}]",
    "returnCity":"[{\"cityId\": 1,\"cityName\": \"郑州\",\"countryId\": 1,\"countryName\": \"中国\"},{\"cityId\": 2,\"cityName\": \"青岛\",\"countryId\": 1,\"countryName\": \"中国\"}]",
    "cargoName":"绿豆",
    "repairFee":5,
    "repairFeeCurrency":"USD",
    "boxUsagePeriod":60,
    "overdueFeeDay": 10,
    "overdueFeeCurrency":"USD",
    "lossDay":80,
    "lossFee":12000,
    "groundingMethod":5,
    "remark": "备注",
    "releaseCallbackPriceList":"[{\"boxType\":5,\"boxCondition\":5,\"totalWeight\":32580,\"inventory\":25,\"carryCityId\":1,\"carryCityName\":\"郑州\",\"carryCountryId\":1,\"carryCountryName\":\"中国\"}]",
    "mainFileList": "[{\"name\":\"20240612/cddd81a833c64a7eab1da5c0aef8dfaf.docx\",\"originalFileName\":\"国际贸易供应链数字平台需求分析(1).docx\",\"url\":\"http://47.122.3.254:9000/default/20240612/cddd81a833c64a7eab1da5c0aef8dfaf.docx\"}]",
    "detailFileList": "[{\"name\":\"20240612/cddd81a833c64a7eab1da5c0aef8dfaf.docx\",\"originalFileName\":\"国际贸易供应链数字平台需求分析(1).docx\",\"url\":\"http://47.122.3.254:9000/default/20240612/cddd81a833c64a7eab1da5c0aef8dfaf.docx\"}]"
}
    */
  })
}

/*发布回调租箱:批量删除
*@param 1803633694563580226,1803633694563580227 是发布回调租箱的Id [1,2]
*/
export const deletePitch = (data: any) => {
  return request({
    url: baseUrl,
    method: 'DELETE',
    data: data
  })
}

/*发布回调租箱:批量上架
* @param 1803633694563580226,1803633694563580227 是发布回调租箱的Id [1803633694563580226,1803633694563580227]
*/
export const onShelf = (data: any) => {
  return request({
    url: baseUrl+'/onShelf',
    method: 'PUT',
    data: data 
  })
}

/*发布回调租箱:批量下架
* @param 1803633694563580226,1803633694563580227 是发布回调租箱的Id [1803633694563580226,1803633694563580227]
*/
export const offShelf = (data: any) => {
  return request({
    url: baseUrl+'/offShelf',
    method: 'PUT',
    data: data 
  })
}

/*发布回调租箱:状态统计
* @param 发布状态: status 发布状态 5-出租中 10-仓库中 15-待发布
* @param 仓库状态: rentSource  5-集装箱公司  10-货代
* @result 统计数量: totalQty
*/
export const statusCount = (data: any) => {
  data.rentSource = 5
  return request({
    url: baseUrl+'/statusCount',
    method: 'post',
    data: data
  })
}

export const statusCountRent = (data: any) => {
  data.rentSource = 10
  return request({
    url: baseUrl+'/statusCount',
    method: 'post',
    data: data
  })
}

/**
 * 集装箱公司放入仓库
 * * */
export const boxEastInWarehouse = (data: any) => {
  return request({
   url: baseUrl+'/boxEastInWarehouse',
   method: 'POST',
   data: data
  })
}